package com.wenjie.utils;

import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * @description: 获取到environment来进行获取application的配置信息
 * @author: wenjie
 * @date: 2022/9/19 21:53
 * @version: 1.0
 */
@Component
public class EnvironmentUtils implements EnvironmentAware {

    public static Environment environment;

    public static String getStr(String str) {
        String property = environment.getProperty(str);
        return property;
    }

    @Override
    public void setEnvironment(Environment environment) {
        EnvironmentUtils.environment = environment;
    }
}
